#include "stdafx.h"
#include "dc.h"

namespace uiwin
{
	void DC::DrawColor(const RECT& rc, DWORD color)
	{
		
	}

	void DC::DrawLine(const RECT& rc, int nSize, DWORD dwPenColor, int nStyle /* = PS_SOLID */)
	{
		LOGPEN lg;
		lg.lopnColor = RGB(GetBValue(dwPenColor), GetGValue(dwPenColor), GetRValue(dwPenColor));
		lg.lopnStyle = nStyle;
		lg.lopnWidth.x = nStyle;

		HPEN hpen = ::CreatePenIndirect(&lg);
		HPEN holdpen = (HPEN)SelectObject(hpen);
		POINT ptTemp = {0};
		::MoveToEx(hdc_, rc.left, rc.top, &ptTemp);
		::LineTo(hdc_, rc.right, rc.bottom);

		SelectObject(holdpen);
		::DeleteObject(hpen);
	}

	int DC::GetClipBox(LPRECT lprect)
	{
		return ::GetClipBox(hdc_, lprect);
	}

	HGDIOBJ DC::SelectObject(HGDIOBJ obj)
	{
		return ::SelectObject(hdc_, obj);
	}

	int DC::BitBlt(int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, DWORD rop)
	{
		return ::BitBlt(hdc_, x, y, cx, cy, hdcSrc, x1, y1, rop);
	}

	int DC::FillRect(const RECT *lprc, Brush hbr)
	{
		return ::FillRect(hdc_, lprc, hbr);
	}

	int DC::FillRect(const RECT *lprc, COLORREF color)
	{
		Brush brush(color);
		return FillRect(lprc, brush);
	}

	
}